home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 4 / Macwelt DVD 4.cdr / Entwickler / Mac-OS / oxygen / oxygen.app / Contents / Resources / Java / jh.jar / javax / help / SearchTOCItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-06-24  |  2.3 KB  |  91 lines

  1. package javax.help;
  2.  
  3. import java.net.MalformedURLException;
  4. import java.net.URL;
  5. import java.util.Enumeration;
  6. import java.util.Locale;
  7. import java.util.Vector;
  8. import javax.help.search.SearchItem;
  9.  
  10. public class SearchTOCItem extends TOCItem {
  11.    private URL url;
  12.    private Vector sivec;
  13.    private boolean inTOC;
  14.    private double confidence;
  15.  
  16.    public SearchTOCItem(Map.ID var1, Map.ID var2, HelpSet var3, Locale var4) {
  17.       super(var1, var2, var3, var4);
  18.       this.inTOC = true;
  19.       this.url = null;
  20.       this.sivec = new Vector();
  21.       this.confidence = (double)0.0F;
  22.    }
  23.  
  24.    public SearchTOCItem(SearchItem var1) {
  25.       super((Map.ID)null, (Map.ID)null, (HelpSet)null, HelpUtilities.localeFromLang(var1.getLang()));
  26.       this.inTOC = false;
  27.       this.setName(var1.getTitle());
  28.  
  29.       try {
  30.          this.url = new URL(var1.getBase(), var1.getFilename());
  31.       } catch (MalformedURLException var3) {
  32.          this.url = null;
  33.       }
  34.  
  35.       this.sivec = new Vector();
  36.       SearchHit var2 = new SearchHit(var1.getConfidence(), var1.getBegin(), var1.getEnd());
  37.       this.confidence = var1.getConfidence();
  38.       this.sivec.addElement(var2);
  39.    }
  40.  
  41.    public void addSearchHit(SearchHit var1) {
  42.       if (this.sivec.isEmpty()) {
  43.          this.sivec.addElement(var1);
  44.          this.confidence = var1.getConfidence();
  45.       } else {
  46.          for(int var2 = this.sivec.size() - 1; var2 >= 0; --var2) {
  47.             SearchHit var3 = (SearchHit)this.sivec.elementAt(var2);
  48.             if (var3.getConfidence() <= var1.getConfidence()) {
  49.                this.sivec.insertElementAt(var1, var2 + 1);
  50.                break;
  51.             }
  52.  
  53.             if (var2 == 0) {
  54.                this.sivec.insertElementAt(var1, 0);
  55.                this.confidence = var1.getConfidence();
  56.             }
  57.          }
  58.       }
  59.  
  60.    }
  61.  
  62.    public URL getURL() {
  63.       return this.url;
  64.    }
  65.  
  66.    public double getConfidence() {
  67.       return this.confidence;
  68.    }
  69.  
  70.    public Enumeration getConfidences() {
  71.       return new 1(this);
  72.    }
  73.  
  74.    public boolean inTOC() {
  75.       return this.inTOC;
  76.    }
  77.  
  78.    public Enumeration getSearchHits() {
  79.       return this.sivec.elements();
  80.    }
  81.  
  82.    public int hitCount() {
  83.       return this.sivec.size();
  84.    }
  85.  
  86.    // $FF: synthetic method
  87.    static Vector access$000(SearchTOCItem var0) {
  88.       return var0.sivec;
  89.    }
  90. }
  91.